{extends file="main.tpl"}
{block name=head}
<script type="text/javascript">
$(document).ready(function() {	
  $("#partyName").autocomplete("getPartyAj.php", 
	{   
		width: 400,     
		matchContains: true,
		mustMatch: false,
		minChars: 0,
		highlight: false,
		selectFirst: true,
		formatItem: function(data, i, n, value) {   
		  return  value.split("|")[0];
	  }
  });
  $("#partyName").result(function(event, data, formatted) {
	  $("#partyId").val(data[1]);
	  ledgerFun();
  });  	
});	
function ledgerFun()
{
	  var dataString = "partyId=" + $('#partyId').val();
	  $.ajax({
	  type: "GET",
	  url: "ledgerAj.php",
	  data : dataString,
	  success:function(data){ 
  	  $('#ledgerData').html(data);
	  }
	 });
}
function myFunction()
{

	if(confirm("You Want To Remove This Record")== true)
	{
		return true;
	}
	else
	{
		return false;
	}
}
</script>
{/block}
{block name=body}
<form name="form1" id="form1" action="{$smarty.server.PHP_SELF}" method="post">
<table border="0" align="center" width="100%">
<tr>
	<td width="80%" valign="top">
  <table border="0" align="center" width="100%">
  <tr>
    <td align="right" class="table1"><font size="3"><b>Party</b></font></td>
    <td class="table1">                                                               
		<input type="text" name="partyName" id="partyName" class="partyName" autofocus=autofocus required />
		<input type="hidden" name="partyId" id="partyId" />     
    </td>
  </tr>
  </table>
  </td>
</tr>
<tr>
	<td>
<div id="ledgerData"  align="center">
</div>		
  </td>
</tr>
{/block}